package com.jxm.hashmap;

import com.jxm.hashtab.HashTab;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author: jxm
 * @Description:
 * @Date: 2022/9/20 14:20
 * @Version: 1.0
 */
public class Test {

    public static void main(String[] args) {

//        System.out.println("张三sdfasdfasfdasdf".hashCode());
//        System.out.println("张三".hashCode());
//        System.out.println("张三1".hashCode());
//        System.out.println("张三1".hashCode());

        HashMap<String, Object> map = new HashMap<>();

        map.put("k","v");
        map.putIfAbsent("k","v1"); //表示缺席，才放进去（不替换）
        System.out.println(map.get("k"));//结果：v
        map.put("k","v2");//替换原来的value
        System.out.println(map.get("k"));//结果：v2

        Hashtable<String,Object> hashTab = new Hashtable<>();
        hashTab.put("k","v");

        ConcurrentHashMap<Object, Object> concurrentHashMap = new ConcurrentHashMap<>();
        concurrentHashMap.put("k","v");
    }


}
